package com.lyf.scm.common.util;

import com.lyf.scm.common.enums.BaseEnum;

/**
 * @author sunquan
 * @version 1.0
 * @date 2020/7/16
 * @desc
 */
public class EnumUtil {

    /**
     * 判断枚举值是否存在于指定枚举数组中
     *
     * @param enums 枚举数组
     * @param code 枚举值
     * @return boolean
     */
    public static boolean isInclude(BaseEnum[] enums, Integer code) {
        if (code == null) {
            return false;
        }
        for (BaseEnum e : enums) {
            if (code.equals(e.getCode())) {
                return true;
            }
        }
        return false;
    }

}
